﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;

namespace OnlineCooperation
{
    /// <summary>
    /// TeamFileCreateFolder 的摘要说明
    /// </summary>
    public class TeamFileCreateFolder : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            if (context.Session["CurrentDir"] == null || context.Session["CurrentDir"].ToString() == "")
                return;

            String dir = context.Session["CurrentDir"].ToString();

            context.Response.ContentType = "text/plain";
            string targetPath=dir+context.Request["FolderName"];

            // Delete a directory and all subdirectories with Directory static method...
            if (!System.IO.Directory.Exists(targetPath))
            {
                System.IO.Directory.CreateDirectory(targetPath);
                context.Response.Write("创建成功！");
            }
            else
            {
                context.Response.Write("目录已存在！");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}